import Err from "../libs/Err"
import home from "../handler/home"
import homeSchema from "../schemas/home"

export default function (fastify, opts, done) {
  fastify.addSchema(homeSchema)
  fastify.get('/', async (req, reply) => {
    return "hellow wxpay"
  })

  fastify.post('/', { schema: {body: "hello#"}, attachValidation: true}, async (req, reply) => {
    if (req.validationError) {
      reply.code(400).send(req.validationError.validation)
    }
    let body = req.body
    return home.hello(body)
  })


  done()
}